<template>
  <div v-for="item in form.arr ">
    <Btn :text="item.test"></Btn>
    <el-button type="warning" @click="home">跳转Home</el-button>
  </div>
</template>

<script setup lang='ts'>
import {h, reactive} from 'vue';
import xterm from '../xterm/index.vue'
import router from "@/router";
type Props = {
  text: string
}
let form = reactive({
  arr: [{
    test:1
  },{
    test:2
  }] as any
})
const Btn = (props: Props, ctx: any) => {
  return h(xterm, {
    class: 'p-2.5 text-white bg-green-500 rounded shadow-lg w-20 text-center inline m-1',
    onClick: () => {
      ctx.emit('on-click', console.log(props.text,ctx))
    }
  })
}
let home = ()=>{
  router.push('/Home')
}
</script>